package gui;

import java.awt.GridLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;

import entities.Student;

/**
 * Construct a panel for the loan information of the student
 */
class EmployeeLoanInfoPanel extends JPanel {

	private static final long serialVersionUID = 1L;

	public EmployeeLoanInfoPanel(Student student) {
		setBorder(new TitledBorder(new EtchedBorder(), "Loan Information"));
		setLayout(new GridLayout(6, 1));

		JLabel loanStatus;
		if (student.getLoan().isNew()) {
			loanStatus = new JLabel("Loan Status: New");
		} else {
			loanStatus = new JLabel("Loan Status: Not New");
		}
		add(loanStatus);

		JLabel loanStatus2;
		if (student.getLoan().isApproved()) {
			loanStatus2 = new JLabel("Approved: Yes");
		} else {
			loanStatus2 = new JLabel("Approved: No");
		}
		add(loanStatus2);
		JLabel amtRequested = new JLabel("Amount Requested: $"
				+ student.getLoan().getAmountRequested());
		add(amtRequested);
		JLabel amtReceived = new JLabel("Amount Approved: $"
				+ student.getLoan().getAmountGiven());
		add(amtReceived);
	}
}
